"""Example of adding tasks on app startup."""

from application_factory.extensions import scheduler
from tasks import sync_mongo, inventory_discovery, overview, sys_configure, patch_regular


# @scheduler.task(
#     "interval",
#     id="mongo_patch_sync",
#     minutes=20,
#     max_instances=1,
#     start_date="2000-01-01 12:19:00",
# )
# def sync_mongo_patch():
#     """
#     定时执行任务， 将mongodb中的资产对应补丁数据更新至mysql的补丁详情表(patch)
#     :return:
#     """
#     sync_mongo.sync_mongo_patch()


# @scheduler.task(
#     "interval",
#     id="inventory_discovery",
#     minutes=10,
#     max_instances=1,
#     start_date="2000-01-01 12:19:00",
# )
# def my_inventory_discovery():
#     """
#     定时执行任务， 定时对指定网段内的资产进行扫描，发现新的资产
#     :return:
#     """
#     inventory_discovery.inventory_discovery()



#
# @scheduler.task(
#     "interval",
#     id="sys_conf",
#     minutes=1,
#     max_instances=1,
#     start_date="2000-01-01 12:19:00",
# )
# def sys_conf():
#     sys_configure.get_system_configure()


# @scheduler.task(
#     "interval",
#     id="regular_patch",
#     minutes=15,
#     max_instances=1,
#     start_date="2000-01-01 12:19:00",
# )
# def regular_patch():
#     patch_regular.patch_auto_regular()


def task2(id):
    """Sample task 2.

    Added when /add url is visited.
    """
    import datetime
    date_time = datetime.datetime.now().strftime("%Y-%m-%d, %H:%M:%S")
    print(f"Time is : {date_time}, Running task {id}!")  # noqa: T001
